package com.ww.demo;

public class test {

    public static void main(String[] args) {
        test6();
    }

    public static void test6() {
        String a = "abc";
        String b = "abcd";
        System.out.println(a.compareTo(b));// 1, 大于; 0 等于; -1 小于   同jsp

        Integer c = 273;
        Integer d = 273;
        System.out.println(c==d); //  两位数的时候输出true ,三位数输出false
    }


    public static void test5() {
        String index = "6e";
        try {
            for (int i = 0; i < 10; i++) {
                if (i > Integer.valueOf(index)) {
                    break;
                }
            }

        } catch (NumberFormatException e) {
            System.out.println("NumberFormatException");
        } catch (Exception e) {
            System.out.println("Exception");
            e.printStackTrace();
        }
    }

    public static void test4() {
        String s;
//                System.out.println("s=" + s);
        int x = 5;
        int y = 9;
        int z = 1;
        int w = 9;
        int a = (x > y) ? (y > w) ? x : z : w;
        System.out.println(a);
        System.out.println("5" + 2);
    }

    public static void test3() {
        int i = 0;
        for (i = 0; i < 10; i++) {
            if (i > 6) {
                break;
            }
        }
        System.out.println(i);
    }

    public static void test1() {
        String a = "hello";
        String b = "he" + new String("llo");
        System.out.println(a == b); // false
    }

    public static void test2() {
        int x = 5;

        boolean b1 = true;
        boolean b2 = false;
        System.out.println((x == 5) && !b2);

        if ((x == 4) && !b2) { //
            System.out.print("1");
        }
        System.out.print("2");
        if ((b2 = true) && b1) {
            System.out.print("3");
        }


    }


}
